jQuery(function(){
	/*//获取方案数据 服务器分页
    var serverSchemeData = {};
    serverSchemeData.deviceID="all";
    var serverSchemeTable;
    jQuery(document).ready(function () {

	serverSchemeTable = jQuery('#resultSchemeTable').DataTable({
        "serverSide": true,
        "ordering": false,
        "iDisplayLength":5,
        "ajax": {
            "dataType": "json",
            "type": "get",
            "cache": false,
            "url":window.rootPath+ '/ui/afterSaleMaintain/getpage',
            "data": function (d) {
                return $.extend({}, d, serverSchemeData);
            }
        },
        columns: [
            {
            	data: null
            },
            {
            	data : null,
				defaultContent : "",
				render : function(data,type, full, meta) {
					var operate = '<button type="button" class="btn btn-info btn-sm selectBtn">选择</button>';
					return operate;
				}
            },
            {
                data: 'schemeName'
            },
            {
            	data: 'schemeCode'
            },
            {
                data: 'type'
            },
            {
                data: 'deviceType'
            }
            ],
        "drawCallback": function (oSettings) {
            var k = 0;
            var total = oSettings.aiDisplay.length + oSettings._iDisplayStart;

            for (var i = oSettings._iDisplayStart, iLen = total; i < iLen; i++) {
                $('td:eq(0)', oSettings.aoData[oSettings.aiDisplay[k]].nTr).text(i + 1);
                k++;
            }
            serverSchemeTable.off('click', 'tr');
            serverSchemeTable.on('click','tr',function(event) {
		    event = event|| window.event;
			var target = event.target|| event.scrElement;
			var data = serverSchemeTable.row(this).data();
			if (target.className.indexOf('selectBtn') != -1) {
				selectScheme(data);
			}
			return;
			});
        }
    });
	
	//查询
    jQuery('.searchSchemeBtn').on('click',function(){
        serverSchemeData.key=jQuery('#keyScheme').val();
        serverSchemeTable.draw();
    });
    
    //撤销查询
    jQuery('.resetSchemeBtn').on("click",function(){
        jQuery('#keyScheme').val('');
        serverSchemeData.key ='';
        serverSchemeTable.draw();
    });*/
	  //保存合同备注
    jQuery('.saveContractPlanBtn').on('click', function () {
             var contractID=jQuery("#contractID").val();
             var memo=jQuery("#contractMemo").val();
             jQuery(".saveContractPlanBtn").attr("disabled", true);
             var url = window.rootPath + "/api/contracts/" +contractID;
             var data = {
                     "memo": memo
                 };
             jQuery.ajax({
                     url:encodeURI(url),
                     type:'patch',
                     data: JSON.stringify(data),
                     dataType: 'json',
                     contentType: 'application/json;charset=utf-8',
                     success: function (data) {
                    	 jQuery(".saveContractPlanBtn").attr("disabled", false);
                     }
                 });
         });
});
